import type {
  AddressItem,
  Logistics,
  OrderDetail,
  OrderPre
} from '@/types/order'
import { request } from '@/utils/request'
// 根据处方id获取支付信息
export const reqGetDetailPre = (params: { prescriptionId: string }) =>
  request<OrderPre>('patient/medicine/order/pre', 'GET', params)
// 收货地址列表
export const reqGetAddressList = () =>
  request<AddressItem[]>('patient/order/address')

// 生成药品订单
export const reqCreateMedicineOrder = (data: {
  id: string
  couponId: string
  addressId: string
}) => request<{ id: string }>('patient/medicine/order', 'POST', data)

// 获取药品支付结果详情
export const reqGetMedicalOrderDetail = (id: string) =>
  request<OrderDetail>(`patient/medicine/order/detail/${id}`)

// 获取物流详情
export const reqGetLogisticsDetail = (id: string) =>
  request<Logistics>(`patient/order/${id}/logistics`)
